package com.aisi.commonUtil;

import com.aisi.model.entity.system.SysUser;

/**
 * @Author: shenjianZ
 * @Date: 2024/2/17 9:22
 * @Description:
 */


public class AuthContextUtil {


    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();

    /**
     * 添加数据
     * @param sysUser
     */
    public static void setAuthContext(SysUser sysUser){
        threadLocal.set(sysUser);
    }

    /**
     * 获取数据
     * @return
     */
    public static SysUser getAuthContext(){
        return threadLocal.get();
    }

    /**
     * 移除数据
     */
    public static void removeAuthContext(){
        threadLocal.remove();
    }
}
